package com.guzhi.controller;

import com.guzhi.pojo.JobOption;
import com.guzhi.pojo.Result;
import com.guzhi.service.ReportService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import java.util.List;
import java.util.Map;

@RequestMapping("/report")
@RestController
public class ReportController {
    private static final Logger log = LoggerFactory.getLogger(EmpController.class);

    @Autowired
    private ReportService reportService;

    //统计员工职位人数
    @GetMapping("/empJobData")
    public Result getEmpJobData(){
        log.info("统计员工职位人数");
        JobOption jobOption =reportService.getEmpJobData();
        return Result.success(jobOption);
    }


    //统计员工性别人数
    @GetMapping("/empGenderData")
    public Result getEmpGenderData(){
        log.info("统计员工性别人数");
        List<Map<String,Object>> genderList= reportService.getEmpGenderData();
        return Result.success(genderList);

    }

}
